package me.firstapp.module.bbs;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import me.firstapp.module.base.CommonEntity;
import me.firstapp.module.shop.Product;

/**
 * 用户话题收藏
 * 
 * @author FirstApp.Me
 *
 */
@Entity
@Table(name = "MEMBER_COLLECTION")
public class Collection extends CommonEntity {
	private static final long serialVersionUID = -1901506787472575792L;

	// 关联的用户
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(nullable = false, name = "MEMBER_ID", referencedColumnName = "ID")
	private Member member;

	// 关联的话题
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(nullable = true, name = "TOPIC_ID", referencedColumnName = "ID")
	private Topic topic;

	// 关联的商品
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(nullable = true, name = "PRODUCT_ID", referencedColumnName = "ID")
	private Product product;

	// 收藏类型，0为话题，1为商品
	@Column(name = "TYPE", columnDefinition = "TINYINT", nullable = false)
	private Integer type;

	public Member getMember() {
		return member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	public Topic getTopic() {
		return topic;
	}

	public void setTopic(Topic topic) {
		this.topic = topic;
	}

	public Product getProduct() {
		return product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

}
